﻿#region
/*******************************************************************************
** File Name:		    RightsRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Phoenix.Entity;
using Phoenix.Respository;
using IBatisNet.DataMapper;
using Phoenix.Data.IBatis;

namespace Phoenix.IBatisRepository
{
    public class RightsRepository : BaseIBatisDao,IRights
    {
    
		#region  Auto Generation

        public RightsRepository()
            : base("/Config/IBatis/86TCMap.Config")
        {

        }
        		
        public void AddRights(ERights entity)
        {
			string stmtId = "RightsMap.InsertRights";
			base.SqlMapper.Insert(stmtId, entity);
        }
        
		public  ERights GetByRightID (System.Int32 rightID)
        {
			string stmtId = "RightsMap.SelectByRightID";
			return base.SqlMapper.QueryForObject<ERights>(stmtId, rightID);
        }
        
        public  void DeleteByRightID (System.Int32 rightID)
        {
			string stmtId = "RightsMap.DeleteByRightID";
			base.SqlMapper.Update(stmtId, rightID);
        }
        
        public  void UpdateByRightID (ERights entity)
        {
			string stmtId = "RightsMap.UpdateByRightID";
			base.SqlMapper.Update(stmtId, entity);
        }


		#endregion

        public IList<ERights> GetByRightTypeID(System.Int32 rightTypeID)
        {
            string stmtId = "RightsMap.SelectByRightTypeID";
            return base.SqlMapper.QueryForList<ERights>(stmtId, rightTypeID);
        }

        public IList<ERights> GetAll()
        {
            string stmtId = "RightsMap.SelectAll";
            return base.SqlMapper.QueryForList<ERights>(stmtId, null);
        }

    }
}

